package me.felix.system.biz.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import me.felix.system.biz.converter.UserConverter;
import me.felix.system.biz.dto.UserDTO;
import me.felix.system.biz.service.UserService;
import me.felix.system.integration.dao.UserMapper;
import me.felix.system.integration.po.UserPO;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author felix
 * @date 2022/1/8/0008
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public List<UserDTO> getUserById(String id) {
        LambdaQueryWrapper<UserPO> query = new LambdaQueryWrapper<>();
        List<UserPO> userPOS = userMapper.selectList(query.eq(UserPO::getIdUser,id));
        List<UserDTO> userDTOS = UserConverter.INSTANCE.converterToUserDTOList(userPOS);
        return userDTOS;
    }
}
